<template>
  <div>
    <CloudMenu
      style="width: 256px"
      :default-selected-keys="['1']"
      :open-keys.sync="openKeys"
      mode="inline"
      @click="handleClick"
    >
      <CloudSubMenu key="sub1" @titleClick="titleClick">
        <span slot="title"><CloudIcon type="mail" /><span>Navigation One</span></span>
        <CloudMenuItemGroup key="g1">
          <template slot="title"> <CloudIcon type="qq" /><span>Item 1</span> </template>
          <CloudMenuItem key="1">
            Option 1
          </CloudMenuItem>
          <CloudMenuItem key="2">
            Option 2
          </CloudMenuItem>
        </CloudMenuItemGroup>
        <CloudMenuItemGroup key="g2" title="Item 2">
          <CloudMenuItem key="3">
            Option 3
          </CloudMenuItem>
          <CloudMenuItem key="4">
            Option 4
          </CloudMenuItem>
        </CloudMenuItemGroup>
      </CloudSubMenu>
      <CloudSubMenu key="sub2" @titleClick="titleClick">
        <span slot="title"><CloudIcon type="appstore" /><span>Navigation Two</span></span>
        <CloudMenuItem key="5">
          Option 5
        </CloudMenuItem>
        <CloudMenuItem key="6">
          Option 6
        </CloudMenuItem>
        <CloudSubMenu key="sub3" title="Submenu">
          <CloudMenuItem key="7">
            Option 7
          </CloudMenuItem>
          <CloudMenuItem key="8">
            Option 8
          </CloudMenuItem>
        </CloudSubMenu>
      </CloudSubMenu>
      <CloudSubMenu key="sub4">
        <span slot="title"><CloudIcon type="setting" /><span>Navigation Three</span></span>
        <CloudMenuItem key="9">
          Option 9
        </CloudMenuItem>
        <CloudMenuItem key="10">
          Option 10
        </CloudMenuItem>
        <CloudMenuItem key="11">
          Option 11
        </CloudMenuItem>
        <CloudMenuItem key="12">
          Option 12
        </CloudMenuItem>
      </CloudSubMenu>
    </CloudMenu>
  </div>
</template>
<script>
export default {
  title: '2.内嵌菜单',
  data() {
    return {
      current: ['mail'],
      openKeys: ['sub1'],
    };
  },
  watch: {
    openKeys(val) {
      console.log('openKeys', val);
    },
  },
  methods: {
    handleClick(e) {
      console.log('click', e);
    },
    titleClick(e) {
      console.log('titleClick', e);
    },
  },
};
</script>